<?php


namespace App\Tool;


class Obj
{

    static function getAttr($obj,$attr){

        try {


            $attr_array = explode('.', $attr);

            foreach ($attr_array as $value) {

                $obj = $obj->$value;

            }

            return $obj;

        }catch (\Exception $exception){

            return null;

        }

    }

}
